/*
* EfficiencyServiceImp.java
* Created on  2015/5/24 19:59
* 版本       修改时间          作者      修改内容
* V1.0.1    2015/5/24       xfz    初始版本
*
*/

package com.infitecs.eyas.boiler.service.impl;

import com.infitecs.eyas.boiler.dao.AirGasParameterDao;
import com.infitecs.eyas.boiler.dao.EfficiencyDao;
import com.infitecs.eyas.boiler.dao.SodaParameterDao;
import com.infitecs.eyas.boiler.model.AirGasParameter;
import com.infitecs.eyas.boiler.model.Efficiency;
import com.infitecs.eyas.boiler.model.SodaParameter;
import com.infitecs.eyas.boiler.service.AirGasParameterService;
import com.infitecs.eyas.boiler.service.EfficiencyService;
import com.infitecs.eyas.combustion.dao.BurnDao;
import com.infitecs.eyas.combustion.dao.ChimneyDao;
import com.infitecs.eyas.combustion.dao.CleanDao;
import com.infitecs.eyas.combustion.model.CalculateBurn;
import com.infitecs.eyas.combustion.model.CalculateChimney;
import com.infitecs.eyas.combustion.model.CalculateClean;
import com.infitecs.eyas.combustion.service.BurnService;
import com.infitecs.eyas.combustion.service.ChimneyService;
import com.infitecs.eyas.combustion.service.CleanService;
import com.infitecs.eyas.constant.Constant;
import com.infitecs.eyas.expression.dao.ExpressionDao;
import com.infitecs.eyas.expression.model.Formula;
import com.infitecs.eyas.mill.dao.MillSelectDao;
import com.infitecs.eyas.mill.dao.PipeCalculateDao;
import com.infitecs.eyas.mill.model.MillSelect;
import com.infitecs.eyas.mill.model.PipeCalculate;
import com.infitecs.eyas.mill.service.MillSelectService;
import com.infitecs.eyas.mill.service.PipeCalculateService;
import com.infitecs.eyas.nature.dao.NatureDao;
import com.infitecs.eyas.nature.model.Nature;
import com.infitecs.eyas.power.dao.OperateFieldDao;
import com.infitecs.eyas.power.model.OperateField;
import com.infitecs.eyas.quality.dao.ElementDao;
import com.infitecs.eyas.quality.dao.IndustryDao;
import com.infitecs.eyas.quality.model.Element;
import com.infitecs.eyas.quality.model.Industry;
import com.infitecs.eyas.result.dao.MiddleResultDao;
import com.infitecs.eyas.result.model.MiddleResult;
import com.infitecs.eyas.runcoalbin.dao.CoalBunkerDao;
import com.infitecs.eyas.runcoalbin.model.CoalBunker;
import com.infitecs.eyas.runcoalbin.service.CoalBunkerService;
import com.infitecs.eyas.util.DoubleUtil;
import com.infitecs.eyas.util.Parameter;
import com.infitecs.eyas.util.ParametersUtil;
import com.infitecs.krill.ajax.response.AjaxResponse;
import fr.expression4j.core.Expression;
import fr.expression4j.core.Parameters;
import fr.expression4j.core.exception.EvalException;
import fr.expression4j.core.exception.ParsingException;
import fr.expression4j.factory.ExpressionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;

/**
 * 类的描述信息
 *
 * @author xfz
 * @version 1.0.1
 */


@Service("EfficiencyService")
@Transactional
public class EfficiencyServiceImp implements EfficiencyService {
    @Autowired
    private EfficiencyDao efficiencyDao;
    @Autowired
    private ExpressionDao expressionDao;
    @Autowired
    private ElementDao elementDao;
    @Autowired
    private SodaParameterDao sodaParameterDao;
    @Autowired
    private IndustryDao industryDao;
    @Autowired
    MiddleResultDao middleResultDao;
    @Autowired
    private AirGasParameterDao airGasParameterDao;
    @Autowired
    private NatureDao natureDao;
    @Autowired
    AirGasParameterService airGasParameterService;
    @Autowired
    private OperateFieldDao operateFieldDao;
    @Autowired
    private CoalBunkerDao coalBunkerDao;
    @Autowired
    private CoalBunkerService coalBunkerService;
    @Autowired
    private BurnService burnService;
    @Autowired
    private BurnDao burnDao;
    @Autowired
    private CleanService cleanService;
    @Autowired
    private CleanDao cleanDao;
    @Autowired
    private ChimneyDao chimneyDao;
    @Autowired
    private ChimneyService chimneyService;
    @Autowired
    private MillSelectDao millSelectDao;
    @Autowired
    private MillSelectService millSelectService;
    @Autowired
    private PipeCalculateService pipeCalculateService;
    @Autowired
    private PipeCalculateDao pipeCalculateDao;

    @Override
    public double calculateTheValueOfE88(int caseId) {
        Element element = elementDao.getElementByPowerCaseId(caseId);
        double E62 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E62"));
        double E87 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E87"));
        double E15 = element.getQnetAr();
        Formula formula = expressionDao.getFormulaByName("锅炉公式46");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E62", E62));
        params.add(new Parameter("E87", E87));
        params.add(new Parameter("ME15", E15));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        double E88 = DoubleUtil.getInstance().get2Double(result);
        efficiencyDao.updateE88(E88, caseId);
        return result;
    }

    @Override
    public double calculateTheValueOfE89(int caseId) {
        Efficiency efficiency = efficiencyDao.getEfficiencyByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式47");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E88", efficiency.getE88()));
        params.add(new Parameter("E52", efficiency.getE52()));
        params.add(new Parameter("E53", efficiency.getE53()));
        params.add(new Parameter("E54", efficiency.getE54()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        double E89 = DoubleUtil.getInstance().get2Double(result);
        efficiencyDao.updateE89(E89, caseId);
        return E89;
    }

    @Override
    public double calculateTheValueOfE90(int caseId) {
        Efficiency efficiency = efficiencyDao.getEfficiencyByPowerCaseId(caseId);
        Element element = elementDao.getElementByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式48");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E89", efficiency.getE89()));
        params.add(new Parameter("ME17", element.getQgrAr()));
        params.add(new Parameter("ME13", element.getQnetAr()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        double E90 = DoubleUtil.getInstance().get2Double(result);
        efficiencyDao.updateE90(E90, caseId);
        //  E90 = DoubleUtil.getInstance().get2Double(E90);
        return E90;
    }

    @Override
    public double calculateTheValueOfE91(int caseId) {
        SodaParameter sodaParameter = sodaParameterDao.getSodaParameter(caseId);
        HashMap<String, Double> map = new HashMap<String, Double>();
        map.put("E3", sodaParameter.getDgr());
        map.put("E6", sodaParameter.getIgr());
        map.put("E9", sodaParameter.getIgs());
        map.put("E13", sodaParameter.getDzr());
        map.put("E24", sodaParameter.getDdesR());
        map.put("E16", sodaParameter.getIzr());
        map.put("E19", sodaParameter.getIzr3());
        map.put("E30", sodaParameter.getDbw());
        map.put("E12", sodaParameter.getIqb());
        map.put("E23", sodaParameter.getHdesS());
        map.put("E27", sodaParameter.getHdesR());
        Formula formula = expressionDao.getFormulaByName(Constant.BOILER_FORMULA_NAME_49);
        org.xidea.el.Expression expression = new org.xidea.el.impl.ExpressionImpl(formula.getFormulaDescription());
        Object result = expression.evaluate(map);
        double E91 = Double.parseDouble(result.toString());
        return E91;
    }

    @Override
    public double calculateTheValueOfE93(int caseId) {
        Efficiency efficiency = efficiencyDao.getEfficiencyByPowerCaseId(caseId);
        Element element = elementDao.getElementByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式51");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        double E91 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E91"));
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E91", E91));
        params.add(new Parameter("E89", efficiency.getE89()));
        params.add(new Parameter("ME15", element.getQnetAr()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        double E93 = DoubleUtil.getInstance().get2Double(result);
        efficiencyDao.updateE93(E93, caseId);
        return E93;
    }

    @Override
    public double calculateTheValueOfE92(int caseId) {
        Efficiency efficiency = efficiencyDao.getEfficiencyByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式50");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E93", efficiency.getE93()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        double E92 = DoubleUtil.getInstance().get2Double(result);
        efficiencyDao.updateE92(E92, caseId);
        return E92;
    }

    @Override
    public double calculateTheValueOfE94(int caseId) {
        Efficiency efficiency = efficiencyDao.getEfficiencyByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式52");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E92", efficiency.getE92()));
        params.add(new Parameter("E52", efficiency.getE52()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        double E94 = DoubleUtil.getInstance().get2Double(result);
        efficiencyDao.updateE94(E94, caseId);
        return E94;
    }

    @Override
    public double calculateTheValueOfE95(int caseId) {
        Efficiency efficiency = efficiencyDao.getEfficiencyByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式53");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E94", efficiency.getE94()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        double E95 = DoubleUtil.getInstance().get2Double(result);
        efficiencyDao.updateE95(E95, caseId);
        return E95;
    }

    @Override
    public double calculateTheValueOfE51(int caseId) {
        Industry industry = industryDao.getIndustryByPowerCaseId(caseId);
        double E10 = industry.getVdaf();
        double E51;
        if (E10 > 30)
            E51 = 2;
        else
            E51 = -0.25 * E10 + 10;
        efficiencyDao.updateE51(E51, caseId);
        return E51;
    }

    @Override
    public double calculateTheValueOfE52(int caseId, double e51) {
        Element element = elementDao.getElementByPowerCaseId(caseId);
        Industry industry = industryDao.getIndustryByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式11");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("ME6", industry.getAar()));
        params.add(new Parameter("E51", e51));
        params.add(new Parameter("ME13", element.getQnetAr()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get2Double(result);
    }

    @Override
    public double calculateTheValueOfE53(int caseId) {
        Element element = elementDao.getElementByPowerCaseId(caseId);
        Industry industry = industryDao.getIndustryByPowerCaseId(caseId);
        double E53;
        double E13 = element.getQnetAr();
        double E6 = industry.getAar();
        if (E13 / 420 > E6)
            E53 = 0;
        else
            E53 = 100 / E13;
        E53 = DoubleUtil.getInstance().get2Double(E53);
        efficiencyDao.updateE53(E53, caseId);
        return E53;
    }

    @Override
    public void saveTheValueOfE89(double E89, int caseId) {
        E89 = DoubleUtil.getInstance().get2Double(E89);
        efficiencyDao.updateE89(E89, caseId);
    }

    @Override
    public void saveTheValueOfIsKnown(boolean isKnown, int caseId) {
        efficiencyDao.updateIsKnown(isKnown, caseId);
    }

    @Override
    public void saveTheValueOfCount(int caseId) {
        efficiencyDao.updateCount(caseId);
    }

    @Override
    public void saveTheValueOfE90(double E90, int caseId) {
        E90 = DoubleUtil.getInstance().get2Double(E90);
        efficiencyDao.updateE90(E90, caseId);
    }

    @Override
    public void saveTheValueOfE51(double E51, int caseId) {
        E51 = DoubleUtil.getInstance().get2Double(E51);
        efficiencyDao.updateE51(E51, caseId);
    }

    @Override
    public void saveTheValueOfE52(double E52, int caseId) {
        E52 = DoubleUtil.getInstance().get2Double(E52);
        efficiencyDao.updateE52(E52, caseId);
    }

    @Override
    public void saveTheValueOfE53(double E53, int caseId) {
        E53 = DoubleUtil.getInstance().get2Double(E53);
        efficiencyDao.updateE53(E53, caseId);
    }

    @Override
    public void saveTheValueOfE54(double E54, int caseId) {
        E54 = DoubleUtil.getInstance().get2Double(E54);
        efficiencyDao.updateE54(E54, caseId);
    }

    @Override
    public void saveTheValueOfE88(double E88, int caseId) {
        E88 = DoubleUtil.getInstance().get2Double(E88);
        efficiencyDao.updateE88(E88, caseId);
    }

    @Override
    public void saveTheValueOfE92(double E92, int caseId) {
        E92 = DoubleUtil.getInstance().get2Double(E92);
        efficiencyDao.updateE92(E92, caseId);
    }

    @Override
    public void saveTheValueOfE93(double E93, int caseId) {
        E93 = DoubleUtil.getInstance().get2Double(E93);
        efficiencyDao.updateE93(E93, caseId);
    }

    @Override
    public void saveTheValueOfE94(double E94, int caseId) {
        E94 = DoubleUtil.getInstance().get2Double(E94);
        efficiencyDao.updateE94(E94, caseId);
    }

    @Override
    public void saveTheValueOfE95(double E95, int caseId) {
        E95 = DoubleUtil.getInstance().get2Double(E95);
        efficiencyDao.updateE95(E95, caseId);
    }

    @Override
    public Efficiency getEfficiency(int caseId) {
        return efficiencyDao.getEfficiencyByPowerCaseId(caseId);
    }

    @Override
    public void insertCaseId(int caseId) {
        efficiencyDao.insertCaseId(caseId);
    }

    @Override
    public double getTheValueOfE51(int caseId) {
        Efficiency efficiency = efficiencyDao.getEfficiencyByPowerCaseId(caseId);
        return efficiency.getE51();
    }

    @Override
    public AjaxResponse getAirGasMedian(int caseId) {
        AjaxResponse ajaxResponse = new AjaxResponse();
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Nature nature = natureDao.getNatureByPowerCaseId(caseId);
        Element element = elementDao.getElementByPowerCaseId(caseId);
        Industry industry = industryDao.getIndustryByPowerCaseId(caseId);
        double e36 = airGasParameterService.calculateE36(air, nature);
        double e37 = airGasParameterService.calculateE37(air, nature);
        double e38 = airGasParameterService.calculateE38(air, nature);
        double e39 = airGasParameterService.calculateE39(air, nature);
        double e40 = airGasParameterService.calculateE40(air, nature);
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E40", e40));
        params.add(new Parameter("E36", e36));
        params.add(new Parameter("E38", e38));
        double e41 = airGasParameterService.calculateE41(params);
        double e47 = airGasParameterService.calculateE47(element);
        double e48 = airGasParameterService.calculateE48(e47);
        double e49 = airGasParameterService.calculateE49(air, e48);
        double e51 = airGasParameterService.calculateE51(industry);
        double e52 = airGasParameterService.calculateE52(industry, element, e51);
        double e53 = airGasParameterService.calculateE53(industry, element);
        double e55 = airGasParameterService.calculateE55(element);
        double e56 = airGasParameterService.calculateE56(element);
        double e57 = airGasParameterService.calculateE57(nature, e55);
        double e58 = airGasParameterService.calculateE58(nature, e57);
        double e59 = airGasParameterService.calculateE59(air, e58);
        double e61 = airGasParameterService.calculateE61(air, nature);
        double e63 = airGasParameterService.calculateE63(air, nature);
        double e64 = airGasParameterService.calculateE64(element);
        double e65 = airGasParameterService.calculateE65(element, e55);
        double e66 = airGasParameterService.calculateE66(industry, nature, element, e55);
        double e67 = airGasParameterService.calculateE67(e64, e65);
        double e68 = airGasParameterService.calculateE68(e66, e67);
        double e69 = airGasParameterService.calculateE69(air, e55, e65);
        double e70 = airGasParameterService.calculateE70(air, e55);
        double e71 = airGasParameterService.calculateE71(air, nature, e55, e66);
        double e72 = airGasParameterService.calculateE72(e64, e69, e70);
        double e73 = airGasParameterService.calculateE73(e71, e72);
        double e74 = airGasParameterService.calculateE74(industry, nature, element, air, e55);
        double e75 = airGasParameterService.calculateE75(air, e58, e74);
        double e76 = airGasParameterService.calculateE76(air, industry, nature, e55, e58, e74);
        double e60 = airGasParameterService.calculateE60(e58, e76);
        double e62 = airGasParameterService.calculateE62(air, e60, e61);
        double e77 = airGasParameterService.calculateE77(e55, e65, e76);
        double e78 = airGasParameterService.calculateE78(e55, e76);
        double e79 = airGasParameterService.calculateE79(nature, e55, e66, e76);
        double e80 = airGasParameterService.calculateE80(e64, e77, e78);
        double e81 = airGasParameterService.calculateE81(e79, e80);
        double e82 = airGasParameterService.calculateE82(industry, nature, e55, e76);
        double e83 = airGasParameterService.calculateE83(air);
        double e84 = airGasParameterService.calculateE84(air);
        double e85 = airGasParameterService.calculateE85(air);
        double e86 = airGasParameterService.calculateE86(air);
        double e87 = airGasParameterService.calculateE87(air, e64, e77, e78, e79, e83, e84, e85, e86);
        double e88 = airGasParameterService.calculateE88(element, e62, e87);
        ajaxResponse.addAttribute("e36", DoubleUtil.getInstance().get3Double(e36));
        ajaxResponse.addAttribute("e37", DoubleUtil.getInstance().get3Double(e37));
        ajaxResponse.addAttribute("e38", DoubleUtil.getInstance().get3Double(e38));
        ajaxResponse.addAttribute("e39", DoubleUtil.getInstance().get3Double(e39));
        ajaxResponse.addAttribute("e40", DoubleUtil.getInstance().get3Double(e40));
        ajaxResponse.addAttribute("e41", DoubleUtil.getInstance().get3Double(e41));
        ajaxResponse.addAttribute("e47", DoubleUtil.getInstance().get3Double(e47));
        ajaxResponse.addAttribute("e48", DoubleUtil.getInstance().get3Double(e48));
        ajaxResponse.addAttribute("e49", DoubleUtil.getInstance().get3Double(e49));
        ajaxResponse.addAttribute("e51", DoubleUtil.getInstance().get3Double(e51));
        ajaxResponse.addAttribute("e52", DoubleUtil.getInstance().get3Double(e52));
        ajaxResponse.addAttribute("e53", DoubleUtil.getInstance().get3Double(e53));
        ajaxResponse.addAttribute("e55", DoubleUtil.getInstance().get3Double(e55));
        ajaxResponse.addAttribute("e56", DoubleUtil.getInstance().get3Double(e56));
        ajaxResponse.addAttribute("e57", DoubleUtil.getInstance().get3Double(e57));
        ajaxResponse.addAttribute("e59", DoubleUtil.getInstance().get3Double(e59));
        ajaxResponse.addAttribute("e60", DoubleUtil.getInstance().get3Double(e60));
        ajaxResponse.addAttribute("e61", DoubleUtil.getInstance().get3Double(e61));
        ajaxResponse.addAttribute("e62", DoubleUtil.getInstance().get3Double(e62));
        ajaxResponse.addAttribute("e63", DoubleUtil.getInstance().get3Double(e63));
        ajaxResponse.addAttribute("e64", DoubleUtil.getInstance().get3Double(e64));
        ajaxResponse.addAttribute("e65", DoubleUtil.getInstance().get3Double(e65));
        ajaxResponse.addAttribute("e66", DoubleUtil.getInstance().get3Double(e66));
        ajaxResponse.addAttribute("e67", DoubleUtil.getInstance().get3Double(e67));
        ajaxResponse.addAttribute("e68", DoubleUtil.getInstance().get3Double(e68));
        ajaxResponse.addAttribute("e69", DoubleUtil.getInstance().get3Double(e69));
        ajaxResponse.addAttribute("e70", DoubleUtil.getInstance().get3Double(e70));
        ajaxResponse.addAttribute("e71", DoubleUtil.getInstance().get3Double(e71));
        ajaxResponse.addAttribute("e72", DoubleUtil.getInstance().get3Double(e72));
        ajaxResponse.addAttribute("e73", DoubleUtil.getInstance().get3Double(e73));
        ajaxResponse.addAttribute("e74", DoubleUtil.getInstance().get3Double(e74));
        ajaxResponse.addAttribute("e75", DoubleUtil.getInstance().get3Double(e75));
        ajaxResponse.addAttribute("e76", DoubleUtil.getInstance().get3Double(e76));
        ajaxResponse.addAttribute("e77", DoubleUtil.getInstance().get3Double(e77));
        ajaxResponse.addAttribute("e78", DoubleUtil.getInstance().get3Double(e78));
        ajaxResponse.addAttribute("e79", DoubleUtil.getInstance().get3Double(e79));
        ajaxResponse.addAttribute("e80", DoubleUtil.getInstance().get3Double(e80));
        ajaxResponse.addAttribute("e81", DoubleUtil.getInstance().get3Double(e81));
        ajaxResponse.addAttribute("e82", DoubleUtil.getInstance().get3Double(e82));
        ajaxResponse.addAttribute("e83", DoubleUtil.getInstance().get3Double(e83));
        ajaxResponse.addAttribute("e84", DoubleUtil.getInstance().get3Double(e84));
        ajaxResponse.addAttribute("e85", DoubleUtil.getInstance().get3Double(e85));
        ajaxResponse.addAttribute("e86", DoubleUtil.getInstance().get3Double(e86));
        ajaxResponse.addAttribute("e87", DoubleUtil.getInstance().get3Double(e87));
        ajaxResponse.addAttribute("e88", DoubleUtil.getInstance().get3Double(e88));
        return ajaxResponse;
    }

    public AjaxResponse getEfficiencyMedian(int caseId) {
        AjaxResponse ajaxResponse = getAirGasMedian(caseId);
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Nature nature = natureDao.getNatureByPowerCaseId(caseId);
        Industry industry = industryDao.getIndustryByPowerCaseId(caseId);
        Efficiency efficiency = efficiencyDao.getEfficiencyByPowerCaseId(caseId);
        double e41 = (Double) ajaxResponse.getReturnData().get("e41");
        double e59 = (Double) ajaxResponse.getReturnData().get("e59");
        double e73 = (Double) ajaxResponse.getReturnData().get("e73");
        double e74 = (Double) ajaxResponse.getReturnData().get("e74");
        double e81 = (Double) ajaxResponse.getReturnData().get("e81");
        double e82 = (Double) ajaxResponse.getReturnData().get("e82");
        double e96 = calculateE96(efficiency, air, e59);
        double e97 = calculateE97(air, e41, e96);
        double e98 = calculateE98(nature, air, e97);
        double e99 = calculateE99(air, e96);
        double e100 = calculateE100(nature, air, e99);
        double e101 = calculateE101(air, e41, e96, e97);
        double e102 = calculateE102(nature, air, e101);
        ajaxResponse.addAttribute("e96", e96);
        ajaxResponse.addAttribute("e97", e97);
        ajaxResponse.addAttribute("e98", e98);
        ajaxResponse.addAttribute("e99", e99);
        ajaxResponse.addAttribute("e100", e100);
        ajaxResponse.addAttribute("e101", e101);
        ajaxResponse.addAttribute("e102", e102);
        double e103 = calculateE103(ajaxResponse, efficiency, air);
        double e104 = calculateE104(e103);
        double e105 = calculateE105(e103);
        double e106 = calculateE106(e103);
        double e107 = calculateE107(e103);
        ajaxResponse.addAttribute("e103", e103);
        ajaxResponse.addAttribute("e104", e104);
        ajaxResponse.addAttribute("e105", e105);
        ajaxResponse.addAttribute("e106", e106);
        ajaxResponse.addAttribute("e107", e107);
        double e108 = calculateE108(ajaxResponse, efficiency, air);
        double e109 = calculateE109(efficiency, e73, e108);
        double e110 = calculateE110(efficiency, e74);
        double e112 = calculateE112(air, e97, e110);
        double e113 = calculateE113(e97, e112);
        double e114 = calculateE114(e97, e113);
        double e115 = calculateE115(air, nature, e114);
        double e116 = calculateE116(e101, e114);
        double e117 = calculateE117(air, nature, e116);
        double e118 = calculateE118(air, e110, e113);
        double e119 = calculateE119(e99, e118);
        double e120 = calculateE120(air, nature, e119);
        ajaxResponse.addAttribute("e108", e108);
        ajaxResponse.addAttribute("e109", e109);
        ajaxResponse.addAttribute("e110", e110);
        ajaxResponse.addAttribute("e112", e112);
        ajaxResponse.addAttribute("e113", e113);
        ajaxResponse.addAttribute("e114", e114);
        ajaxResponse.addAttribute("e115", e115);
        ajaxResponse.addAttribute("e116", e116);
        ajaxResponse.addAttribute("e117", e117);
        ajaxResponse.addAttribute("e118", e118);
        ajaxResponse.addAttribute("e119", e119);
        ajaxResponse.addAttribute("e120", e120);
        double e121 = calculateE121(ajaxResponse, air);
        double e122 = calculateE122(e121);
        double e123 = calculateE123(e121);
        double e124 = calculateE124(e121);
        double e125 = calculateE125(e121);
        ajaxResponse.addAttribute("e120", e120);
        ajaxResponse.addAttribute("e121", e121);
        ajaxResponse.addAttribute("e122", e122);
        ajaxResponse.addAttribute("e123", e123);
        ajaxResponse.addAttribute("e124", e124);
        ajaxResponse.addAttribute("e125", e125);
        double e126 = calculateE126(ajaxResponse, air);
        double e127 = calculateE127(efficiency, e82);
        double e128 = calculateE128(efficiency, e81, e126);
        double e129 = calculateE129(industry, air, e73);
        double e130 = calculateE130(e118, e119);
        double e131 = calculateE131(e41);
        ajaxResponse.addAttribute("e126", e126);
        ajaxResponse.addAttribute("e127", e127);
        ajaxResponse.addAttribute("e128", e128);
        ajaxResponse.addAttribute("e129", e129);
        ajaxResponse.addAttribute("e130", e130);
        ajaxResponse.addAttribute("e131", e131);
        return ajaxResponse;
    }

    private double calculateE131(double e41) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式88");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E41", e41));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE130(double e118, double e119) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式87");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E118", e118));
        params.add(new Parameter("E119", e119));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE129(Industry industry, AirGasParameter air, double e73) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式86");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E28", air.getE28()));
        params.add(new Parameter("E73", e73));
        params.add(new Parameter("ME6", industry.getAar()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE128(Efficiency efficiency, double e81, double e126) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式85");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E94", efficiency.getE94()));
        params.add(new Parameter("E81", e81));
        params.add(new Parameter("E126", e126));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE127(Efficiency efficiency, double e82) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式84");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E82", e82));
        params.add(new Parameter("E95", efficiency.getE95()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE126(AjaxResponse ajaxResponse, AirGasParameter air) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式83");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e64 = (Double) ajaxResponse.getReturnData().get("e64");
        double e83 = (Double) ajaxResponse.getReturnData().get("e83");
        double e69 = (Double) ajaxResponse.getReturnData().get("e69");
        double e84 = (Double) ajaxResponse.getReturnData().get("e84");
        double e70 = (Double) ajaxResponse.getReturnData().get("e70");
        double e85 = (Double) ajaxResponse.getReturnData().get("e85");
        double e71 = (Double) ajaxResponse.getReturnData().get("e71");
        double e86 = (Double) ajaxResponse.getReturnData().get("e86");
        double e74 = (Double) ajaxResponse.getReturnData().get("e74");
        double e61 = (Double) ajaxResponse.getReturnData().get("e61");
        double e77 = (Double) ajaxResponse.getReturnData().get("e77");
        double e78 = (Double) ajaxResponse.getReturnData().get("e78");
        double e79 = (Double) ajaxResponse.getReturnData().get("e79");
        double e122 = (Double) ajaxResponse.getReturnData().get("e122");
        double e123 = (Double) ajaxResponse.getReturnData().get("e123");
        double e124 = (Double) ajaxResponse.getReturnData().get("e124");
        double e125 = (Double) ajaxResponse.getReturnData().get("e125");
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E50", air.getOutAirTemperature()));
        params.add(new Parameter("E64", e64));
        params.add(new Parameter("E83", e83));
        params.add(new Parameter("E69", e69));
        params.add(new Parameter("E84", e84));
        params.add(new Parameter("E70", e70));
        params.add(new Parameter("E85", e85));
        params.add(new Parameter("E71", e71));
        params.add(new Parameter("E86", e86));
        params.add(new Parameter("E46", air.getAirPreheaterAirLeakageCoefficient()));
        params.add(new Parameter("E74", e74));
        params.add(new Parameter("E61", e61));
        params.add(new Parameter("E77", e77));
        params.add(new Parameter("E78", e78));
        params.add(new Parameter("E79", e79));
        params.add(new Parameter("E123", e123));
        params.add(new Parameter("E122", e122));
        params.add(new Parameter("E124", e124));
        params.add(new Parameter("E125", e125));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE125(double e121) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式82");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E121", e121));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE124(double e121) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式81");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E121", e121));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE123(double e121) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式80");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E121", e121));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE122(double e121) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式79");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E121", e121));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE121(AjaxResponse ajaxResponse, AirGasParameter air) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式78");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e64 = (Double) ajaxResponse.getReturnData().get("e64");
        double e83 = (Double) ajaxResponse.getReturnData().get("e83");
        double e69 = (Double) ajaxResponse.getReturnData().get("e69");
        double e84 = (Double) ajaxResponse.getReturnData().get("e84");
        double e70 = (Double) ajaxResponse.getReturnData().get("e70");
        double e85 = (Double) ajaxResponse.getReturnData().get("e85");
        double e71 = (Double) ajaxResponse.getReturnData().get("e71");
        double e86 = (Double) ajaxResponse.getReturnData().get("e86");
        double e74 = (Double) ajaxResponse.getReturnData().get("e74");
        double e61 = (Double) ajaxResponse.getReturnData().get("e61");
        double e77 = (Double) ajaxResponse.getReturnData().get("e77");
        double e78 = (Double) ajaxResponse.getReturnData().get("e78");
        double e79 = (Double) ajaxResponse.getReturnData().get("e79");
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E50", air.getOutAirTemperature()));
        params.add(new Parameter("E64", e64));
        params.add(new Parameter("E83", e83));
        params.add(new Parameter("E69", e69));
        params.add(new Parameter("E84", e84));
        params.add(new Parameter("E70", e70));
        params.add(new Parameter("E85", e85));
        params.add(new Parameter("E71", e71));
        params.add(new Parameter("E86", e86));
        params.add(new Parameter("E46", air.getAirPreheaterAirLeakageCoefficient()));
        params.add(new Parameter("E74", e74));
        params.add(new Parameter("E61", e61));
        params.add(new Parameter("E77", e77));
        params.add(new Parameter("E78", e78));
        params.add(new Parameter("E79", e79));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE120(AirGasParameter air, Nature nature, double e119) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式77");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E119", e119));
        params.add(new Parameter("E32", air.getInTwiceWindTemperature()));
        params.add(new Parameter("ZE15", nature.getLocalDensityMoistAir()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE119(double e99, double e118) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式76");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E118", e118));
        params.add(new Parameter("E99", e99));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE118(AirGasParameter air, double e110, double e113) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式75");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E110", e110));
        params.add(new Parameter("E113", e113));
        params.add(new Parameter("E46", air.getAirPreheaterAirLeakageCoefficient()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE117(AirGasParameter air, Nature nature, double e116) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式74");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E116", e116));
        params.add(new Parameter("ZE15", nature.getLocalDensityMoistAir()));
        params.add(new Parameter("E31", air.getInOnceWindTemperature()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE116(double e101, double e114) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式73");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E114", e114));
        params.add(new Parameter("E101", e101));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE115(AirGasParameter air, Nature nature, double e114) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式72");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E114", e114));
        params.add(new Parameter("E31", air.getInOnceWindTemperature()));
        params.add(new Parameter("ZE15", nature.getLocalDensityMoistAir()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE114(double e97, double e113) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式71");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E97", e97));
        params.add(new Parameter("E113", e113));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE113(double e97, double e112) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式70");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E97", e97));
        params.add(new Parameter("E112", e112));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE112(AirGasParameter air, double e97, double e110) {
        double e111 = air.getWarehouse();
        double e46 = air.getAirPreheaterAirLeakageCoefficient();
        Double result = null;
        result = (e111 == 1) ? (e46 * (1 - 0.001 / e46)) / (e97 / e110 + (e46 * (1 - 0.001 / e46))) : (e46 * (1 + 0.006 / e46)) / (e97 / e110 + (e46 * (1 + 0.006 / e46)));
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE110(Efficiency efficiency, double e74) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式68");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E74", e74));
        params.add(new Parameter("E94", efficiency.getE94()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE109(Efficiency efficiency, double e73, double e108) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式67");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E73", e73));
        params.add(new Parameter("E108", e108));
        params.add(new Parameter("E94", efficiency.getE94()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE108(AjaxResponse ajaxResponse, Efficiency efficiency, AirGasParameter air) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式66");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e97 = (Double) ajaxResponse.getReturnData().get("e97");
        double e38 = (Double) ajaxResponse.getReturnData().get("e38");
        double e36 = (Double) ajaxResponse.getReturnData().get("e36");
        double e99 = (Double) ajaxResponse.getReturnData().get("e99");
        double e39 = (Double) ajaxResponse.getReturnData().get("e39");
        double e37 = (Double) ajaxResponse.getReturnData().get("e37");
        double e87 = (Double) ajaxResponse.getReturnData().get("e87");
        double e104 = (Double) ajaxResponse.getReturnData().get("e104");
        double e105 = (Double) ajaxResponse.getReturnData().get("e105");
        double e106 = (Double) ajaxResponse.getReturnData().get("e106");
        double e107 = (Double) ajaxResponse.getReturnData().get("e107");
        double e64 = (Double) ajaxResponse.getReturnData().get("e64");
        double e69 = (Double) ajaxResponse.getReturnData().get("e69");
        double e70 = (Double) ajaxResponse.getReturnData().get("e70");
        double e71 = (Double) ajaxResponse.getReturnData().get("e71");

        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E97", e97));
        params.add(new Parameter("E95", efficiency.getE95()));
        params.add(new Parameter("E33", air.getOutOnceWindTemperature()));
        params.add(new Parameter("E38", e38));
        params.add(new Parameter("E31", air.getInOnceWindTemperature()));
        params.add(new Parameter("E36", e36));
        params.add(new Parameter("E99", e99));
        params.add(new Parameter("E39", e39));
        params.add(new Parameter("E34", air.getOutTwiceWindTemperature()));
        params.add(new Parameter("E37", e37));
        params.add(new Parameter("E32", air.getInTwiceWindTemperature()));
        params.add(new Parameter("E87", e87));
        params.add(new Parameter("E104", e104));
        params.add(new Parameter("E105", e105));
        params.add(new Parameter("E106", e106));
        params.add(new Parameter("E107", e107));
        params.add(new Parameter("E64", e64));
        params.add(new Parameter("E69", e69));
        params.add(new Parameter("E70", e70));
        params.add(new Parameter("E71", e71));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE107(double e103) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式65");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E103", e103));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE106(double e103) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式64");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E103", e103));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE105(double e103) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式63");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E103", e103));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE104(double e103) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式62");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E103", e103));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE103(AjaxResponse ajaxResponse, Efficiency efficiency, AirGasParameter air) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式61");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e97 = (Double) ajaxResponse.getReturnData().get("e97");
        double e38 = (Double) ajaxResponse.getReturnData().get("e38");
        double e36 = (Double) ajaxResponse.getReturnData().get("e36");
        double e99 = (Double) ajaxResponse.getReturnData().get("e99");
        double e39 = (Double) ajaxResponse.getReturnData().get("e39");
        double e37 = (Double) ajaxResponse.getReturnData().get("e37");
        double e83 = (Double) ajaxResponse.getReturnData().get("e83");
        double e64 = (Double) ajaxResponse.getReturnData().get("e64");
        double e84 = (Double) ajaxResponse.getReturnData().get("e84");
        double e77 = (Double) ajaxResponse.getReturnData().get("e77");
        double e85 = (Double) ajaxResponse.getReturnData().get("e85");
        double e78 = (Double) ajaxResponse.getReturnData().get("e78");
        double e86 = (Double) ajaxResponse.getReturnData().get("e86");
        double e79 = (Double) ajaxResponse.getReturnData().get("e79");
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E97", e97));
        params.add(new Parameter("E95", efficiency.getE95()));
        params.add(new Parameter("E33", air.getOutOnceWindTemperature()));
        params.add(new Parameter("E38", e38));
        params.add(new Parameter("E31", air.getInOnceWindTemperature()));
        params.add(new Parameter("E36", e36));
        params.add(new Parameter("E99", e99));
        params.add(new Parameter("E39", e39));
        params.add(new Parameter("E34", air.getOutTwiceWindTemperature()));
        params.add(new Parameter("E37", e37));
        params.add(new Parameter("E32", air.getInTwiceWindTemperature()));
        params.add(new Parameter("E83", e83));
        params.add(new Parameter("E64", e64));
        params.add(new Parameter("E84", e84));
        params.add(new Parameter("E77", e77));
        params.add(new Parameter("E85", e85));
        params.add(new Parameter("E78", e78));
        params.add(new Parameter("E86", e86));
        params.add(new Parameter("E79", e79));
        params.add(new Parameter("E50", air.getOutAirTemperature()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE102(Nature nature, AirGasParameter air, double e101) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式60");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E101", e101));
        params.add(new Parameter("ZE15", nature.getLocalDensityMoistAir()));
        params.add(new Parameter("E31", air.getInOnceWindTemperature()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE101(AirGasParameter air, double e41, double e96, double e97) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式59");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E97", e97));
        params.add(new Parameter("E41", e41));
        params.add(new Parameter("E96", e96));
        params.add(new Parameter("E42", air.getOnceWindRate()));
        params.add(new Parameter("E44", air.getE44()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get4Double(result);
    }

    private double calculateE100(Nature nature, AirGasParameter air, double e99) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式58");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E99", e99));
        params.add(new Parameter("ZE15", nature.getLocalDensityMoistAir()));
        params.add(new Parameter("E34", air.getOutTwiceWindTemperature()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE99(AirGasParameter air, double e96) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式57");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E96", e96));
        params.add(new Parameter("E42", air.getOnceWindRate()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private double calculateE98(Nature nature, AirGasParameter air, double e97) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式56");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E97", e97));
        params.add(new Parameter("E33", air.getOutOnceWindTemperature()));
        params.add(new Parameter("ZE15", nature.getLocalDensityMoistAir()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    private Double calculateE97(AirGasParameter air, double e41, double e96) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式55");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E96", e96));
        params.add(new Parameter("E42", air.getOnceWindRate()));
        params.add(new Parameter("E41", e41));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    @Override
    public double calculateTheValueE51(int caseId) {
        Industry industry = industryDao.getIndustryByPowerCaseId(caseId);
        double E10 = industry.getVdaf();
        double E51;
        if (E10 > 30)
            E51 = 2;
        else
            E51 = -0.25 * E10 + 10;
        return DoubleUtil.getInstance().get3Double(E51);
    }

    @Override
    public void efficiencySave(Efficiency efficiency) {
        efficiencySaveData(efficiency);
        //更新原煤仓
        CoalBunker oldCoalBunker = coalBunkerDao.getCoalBunker(efficiency.getPowerCaseId());
        OperateField operateField = operateFieldDao.getOperateField(efficiency.getPowerCaseId());

        //更新原煤仓信息
        if (oldCoalBunker != null) {
            oldCoalBunker.setE9State(operateField.getE9State());
            coalBunkerService.designSaveData(oldCoalBunker);
        }
        //更新燃烧
        CalculateBurn calculateBurn = burnDao.getCalculateBurnByCaseId(efficiency.getPowerCaseId());
        if (calculateBurn != null) {
            calculateBurn.setYyglState(operateField.getYyglState());
            calculateBurn.setE54State(operateField.getE54State());
            calculateBurn.setE88State(operateField.getE88State());
            calculateBurn.setE122State(operateField.getE122State());
            calculateBurn.setE155State(operateField.getE155State());
            calculateBurn.setE171State(operateField.getE171State());
            burnService.burnSaveData(calculateBurn);
        }
        //更新烟气净化系统
        CalculateClean calculateClean = cleanDao.getCalculateClean(efficiency.getPowerCaseId());
        if (calculateClean != null) {
            calculateClean.setE221State(operateField.getE221State());
            calculateClean.setE222State(operateField.getE222State());
            calculateClean.setE231State(operateField.getE231State());
            calculateClean.setE241State(operateField.getE241State());
            calculateClean.setE242State(operateField.getE242State());
            calculateClean.setE248State(operateField.getE248State());
            calculateClean.setE258State(operateField.getE258State());
            cleanService.cleanDataSave(calculateClean);
        }
        //更新烟囱出口直径计算
        CalculateChimney calculateChimney = chimneyDao.getCalculateChimney(efficiency.getPowerCaseId());
        if (calculateChimney != null) {
            calculateChimney.setE314State(operateField.getE314State());
            calculateChimney.setE315State(operateField.getE315State());
            calculateChimney.setE316State(operateField.getE316State());
            calculateChimney.setCaseId(operateField.getCaseId());
            chimneyService.chimneySaveData(calculateChimney);
        }

                //更新磨煤机选择
        MillSelect millSelect = millSelectDao.getMillSelect(efficiency.getPowerCaseId());
        if (millSelect != null) {
            millSelect.setMyglState(operateField.getMyglState());
            millSelect.setE12State(operateField.getE12State());
            millSelect.setE74State(operateField.getE74State());
            millSelect.setE75State(operateField.getE75State());
            millSelect.setModelState(operateField.getModelState());
            millSelectService.chooseDataSave(millSelect);
        }
        //更新煤粉管道计算
        PipeCalculate pipeCalculate = pipeCalculateDao.getPipeCalculate(efficiency.getPowerCaseId());
        if (pipeCalculate != null) {
            pipeCalculateService.pipelineDataSave(pipeCalculate);
        }
    }

    @Override
    public void efficiencySaveData(Efficiency efficiency) {
        AjaxResponse ajaxResponse = getAirGasMedian(efficiency.getPowerCaseId());
        //计算锅炉排烟损失 E88
        efficiency.setE88((Double) ajaxResponse.getReturnData().get("e88"));
        //灰渣物理热损失E53
        efficiency.setE53((Double) ajaxResponse.getReturnData().get("e53"));
        //机械未完全燃烧损失
        if ("0".equals(efficiency.getE52State())) {
            efficiency.setE52((Double) ajaxResponse.getReturnData().get("e52"));
        } else {
            efficiency.setE52(calculateTheValueOfE52(efficiency.getPowerCaseId(), efficiency.getE51()));
        }
        //锅炉效率（低位）E89
        if ("0".equals(efficiency.getE89State())) {
            efficiency.setE89(calculateTheValueOfE89(efficiency));
        }
        Element element = elementDao.getElementByPowerCaseId(efficiency.getPowerCaseId());
        //锅炉效率（高位） E90
        if ("0".equals(efficiency.getE90State())) {
            efficiency.setE90(calculateTheValueOfE90(efficiency, element));
        }
        SodaParameter sodaParameter = sodaParameterDao.getSodaParameter(efficiency.getPowerCaseId());
        //首先计算中间值 E91
        //计算锅炉燃料量E93
        if ("0".equals(efficiency.getE93State())) {
            double e91 = calculateE91(sodaParameter);
            efficiency.setE93(calculateTheValueOfE93(efficiency, element, e91));
        }
        //计算锅炉燃料量E92
        if ("0".equals(efficiency.getE92State())) {
            efficiency.setE92(calculateTheValueOfE92(efficiency));
        }
        //锅炉计算燃煤量E94
        if ("0".equals(efficiency.getE94State())) {
            efficiency.setE94(calculateTheValueOfE94(efficiency));
        }
        //锅炉计算燃煤量E95
        if ("0".equals(efficiency.getE95State())) {
            efficiency.setE95(calculateTheValueOfE95(efficiency));
        }
        Efficiency oldData = efficiencyDao.getEfficiencyByPowerCaseId(efficiency.getPowerCaseId());
        if (oldData == null) {
            efficiencyDao.addEfficiency(efficiency);
        } else {
            efficiencyDao.updateEfficiency(efficiency);
        }
        OperateField operateField = new OperateField();
        operateField.setE52State(efficiency.getE52State());
        operateField.setE89State(efficiency.getE89State());
        operateField.setE90State(efficiency.getE90State());
        operateField.setE92State(efficiency.getE92State());
        operateField.setE93State(efficiency.getE93State());
        operateField.setE94State(efficiency.getE94State());
        operateField.setE95State(efficiency.getE95State());
        operateField.setCaseId(efficiency.getPowerCaseId());
        operateFieldDao.updateOperateFieldEfficiency(operateField);
    }

    public double calculateTheValueOfE89(Efficiency efficiency) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式47");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E88", efficiency.getE88()));
        params.add(new Parameter("E52", efficiency.getE52()));
        params.add(new Parameter("E53", efficiency.getE53()));
        params.add(new Parameter("E54", efficiency.getE54()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        double E89 = DoubleUtil.getInstance().get2Double(result);
        return E89;
    }

    public double calculateTheValueOfE90(Efficiency efficiency, Element element) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式48");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E89", efficiency.getE89()));
        params.add(new Parameter("ME17", element.getQgrAr()));
        params.add(new Parameter("ME13", element.getQnetAr()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        double E90 = DoubleUtil.getInstance().get2Double(result);
        return E90;
    }


    public Double calculateE91(SodaParameter sodaParameter) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式49");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double E3 = sodaParameter.getDgr();
        double E6 = sodaParameter.getIgr();
        double E9 = sodaParameter.getIgs();
        double E13 = sodaParameter.getDzr();
        double E24 = sodaParameter.getDdesR();
        double E16 = sodaParameter.getIzr();
        double E19 = sodaParameter.getIzr3();
        double E30 = sodaParameter.getDbw();
        double E12 = sodaParameter.getIqb();
        double E23 = sodaParameter.getHdesS();
        double E27 = sodaParameter.getHdesR();
        double E20 = sodaParameter.getDdesS();
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E3", E3));
        params.add(new Parameter("E6", E6));
        params.add(new Parameter("E9", E9));
        params.add(new Parameter("E13", E13));
        params.add(new Parameter("E24", E24));
        params.add(new Parameter("E16", E16));
        params.add(new Parameter("E19", E19));
        params.add(new Parameter("E30", E30));
        params.add(new Parameter("E12", E12));
        params.add(new Parameter("E23", E23));
        params.add(new Parameter("E27", E27));
        params.add(new Parameter("E20", E20));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

    public double calculateTheValueOfE93(Efficiency efficiency, Element element, double e91) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式51");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E91", e91));
        params.add(new Parameter("E89", efficiency.getE89()));
        params.add(new Parameter("ME15", element.getQnetAr()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get2Double(result);
    }

    public double calculateTheValueOfE92(Efficiency efficiency) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式50");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E93", efficiency.getE93()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        double E92 = DoubleUtil.getInstance().get2Double(result);
        return E92;
    }

    public double calculateTheValueOfE94(Efficiency efficiency) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式52");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E92", efficiency.getE92()));
        params.add(new Parameter("E52", efficiency.getE52()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        double E94 = DoubleUtil.getInstance().get2Double(result);
        return E94;
    }

    public double calculateTheValueOfE95(Efficiency efficiency) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式53");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E94", efficiency.getE94()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        double E95 = DoubleUtil.getInstance().get2Double(result);
        return E95;
    }

    private double calculateE96(Efficiency efficiency, AirGasParameter air, double e59) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式54");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E59", e59));
        params.add(new Parameter("E95", efficiency.getE95()));
        params.add(new Parameter("E43", air.getE43()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        return DoubleUtil.getInstance().get3Double(result);
    }

}
